<template>
	<view>
		<view class="wanch" style="padding: 20upx 0 10upx 30upx;">学生：{{neirong.stuName}}</view>
		<view class="wanch" v-if="neirong.task1">
			<view class="wc">
				<text class="zbt">完成情况</text>
				<text class="bt zbt">虚拟仿真VR</text>
				<text class="nr">
					内容：{{neirong.task1.name}}
				</text>
				<text class="qd">签到时间：{{neirong.startTime}} {{neirong.task1.signinAddr}}</text>
				<text class="qt">签退时间：{{neirong.endTime}} {{neirong.task1.signoutAdd}}</text>
			</view>
		</view>
		<view class="wanch" v-if="neirong.task9">
			<view class="wc">
				<text class="bt zbt">在线研读</text>
				<text class="nr">
					内容：{{neirong.task9.content}}
				</text>
				<text class="qd" v-if="neirong.task9.isDone == '0'">未研读</text>
				<text class="qd" v-else>未研读</text>
			</view>
		</view>
		<view class="wanch" v-if="neirong.task3">
			<view class="wc">
				<text class="bt zbt">在线观影</text>
				<text class="nr">
					内容：{{neirong.task3.name}}
				</text>
				<text class="qd" v-if="neirong.task3.isDone == '0'">未观看</text>
				<text class="qd" v-else>已观看</text>
			</view>
		</view>
<!-- 		<view class="wanch">
			<view class="wc">
				<text class="bt zbt">4、社会访谈</text>
				<text class="qt">
					{{neirong.task7.remark}}
				</text>
			</view>
		</view> -->
		<view class="wanch" v-if="neirong.task4">
			<view class="wc">
				<text class="bt zbt">全景体验</text>
				<text class="nr">
					内容：{{neirong.task4.name}}
				</text>
				<text class="qd" v-if="neirong.task4.isDone == '0'">未体验</text>
				<text class="qd" v-else>已体验</text>
			</view>
		</view>
		<!-- 建议分数 -->
		<view class="wc jianyi" v-if="neirong.task1||neirong.task9||neirong.task3||neirong.task4">
			<span class="bt">分数：</span>
			<input class="dafen" type="text" v-model="score1" placeholder="输入分数"/>
		</view>
			<view style="display: block !important;" v-if="neirong.task1||neirong.task9||neirong.task3||neirong.task4">
				<button class="mini-btn" type="warn" size="mini" @click="fillScore1(90)" style="margin-left: 20upx;" >优秀</button>
				<button class="mini-btn" type="warn" size="mini" @click="fillScore1(80)" style="margin-left: 20upx;" >良好</button>
				<button class="mini-btn" type="warn" size="mini" @click="fillScore1(70)" style="margin-left: 20upx;" >中等</button>
				<button class="mini-btn" type="warn" size="mini" @click="fillScore1(60)" style="margin-left: 20upx;" >及格</button>
				<button class="mini-btn" type="warn" size="mini" @click="fillScore1(50)" style="margin-left: 20upx;" >不及格</button>
			</view>
		<!-- 横线 -->
		<hengxian v-if="neirong.task1||neirong.task9||neirong.task3||neirong.task4"></hengxian>

		<view class="wanch" v-if="neirong.task5" style="overflow: hidden;">
			<view class="wc">
				<text class="bt zbt">简答题</text>
				<text class="nr">
					{{neirong.task5.remark}}
				</text>
				<textarea class="jianda" v-model="ques1Content" placeholder="" disabled/>
				
				<view style="width: 450upx;" >
					<view v-for="(item,index) in ques1Files">
						<view style="float: left; padding-top: 10upx;  margin-right: 20upx;font-size: 26upx;color: #0000FF;text-decoration:underline;" @click="downFile(item)">简答题{{index+1}}.{{item.split('.').pop().toLowerCase()}}</view>
					</view>
					<view style="height: 20upx;"></view>
				</view>
				
			</view>
		</view>
		<!-- 建议分数 -->
<!-- 		<view class="wc jianyi">
			<span class="bt">建议分数：</span>
			<input class="dafen" type="text" v-model="scores.activitScore" placeholder="输入分数"/>
		</view> -->
		<!-- 横线 -->
		<!-- <hengxian></hengxian> -->
		<view class="wanch" v-if="neirong.task6" style="overflow: hidden;">
			<view class="wc">
				<text class="bt zbt">论述题</text>
				<text class="nr">
					{{neirong.task6.remark}}
				</text>
				<textarea class="jianda" v-model="ques2Content" placeholder="" disabled/>
				
				<view style="width: 450upx;" >
					<view v-for="(item,index) in ques2Files">
						<view style="float: left; padding-top: 10upx;  margin-right: 20upx;font-size: 26upx;color: #0000FF;text-decoration:underline;" @click="downFile(item)">简答题{{index+1}}.{{item.split('.').pop().toLowerCase()}}</view>
					</view>
					<view style="height: 20upx;"></view>
				</view>
			</view>
		</view>
		<view class="wanch" v-if="neirong.task7" style="overflow: hidden;">
			<view class="wc">
				<text class="bt zbt">其他活动</text>
				<text class="nr">
					{{neirong.task7.remark}}
				</text>
				<textarea class="jianda" v-model="contentOther" placeholder="" disabled/>
				<!-- <button v-if="neirong.task7.fileUrl" class="downLoadBtn" @tap="xiazai">下载文件</button> -->
				<view style="width: 450upx;" >
					<view v-for="(item,index) in ques2Files">
						<view style="float: left; padding-top: 10upx;  margin-right: 20upx;font-size: 26upx;color: #0000FF;text-decoration:underline;" @click="downFile(item)">简答题{{index+1}}.{{item.split('.').pop().toLowerCase()}}</view>
					</view>
					<view style="height: 20upx;"></view>
				</view>
				<!-- <view v-else class="style1">未上传</view> -->
				<!-- </text> -->
			</view>
		</view>
		<!-- 建议分数 -->
		<view class="wc jianyi" v-if="neirong.task5||neirong.task6||neirong.task7">
			<span class="bt">分数：</span>
			<input class="dafen" type="text" v-model="score2" value="" placeholder="输入分数"/>
		</view>
		<view style="display: block !important;" v-if="neirong.task5||neirong.task6||neirong.task7">
			<button class="mini-btn" type="warn" size="mini" @click="fillScore2(90)" style="margin-left: 20upx;" >优秀</button>
			<button class="mini-btn" type="warn" size="mini" @click="fillScore2(80)" style="margin-left: 20upx;" >良好</button>
			<button class="mini-btn" type="warn" size="mini" @click="fillScore2(70)" style="margin-left: 20upx;" >中等</button>
			<button class="mini-btn" type="warn" size="mini" @click="fillScore2(60)" style="margin-left: 20upx;" >及格</button>
			<button class="mini-btn" type="warn" size="mini" @click="fillScore2(50)" style="margin-left: 20upx;" >不及格</button>
		</view>
		<!-- 横线 -->
		<hengxian v-if="neirong.task5||neirong.task6"></hengxian>
		<view class="wanch" v-if="neirong.task8" >
			<view class="wc">
				<text class="bt zbt">其他线下活动</text>
				<text class="nr">
					{{neirong.task8.remark}}
				</text>
				<!-- <textarea class="jianda"  value="" placeholder="" disabled/> -->
			</view>
		</view>
		<view class="wanch" v-if="neirong.task10" style="overflow: hidden;">
			<view class="wc">
				<text class="bt zbt">实践报告</text>
				<text class="nr">
					{{neirong.task10.remark}}
				</text>
				<textarea class="jianda" v-model="reportContent" placeholder="" disabled/>
				<view style="width: 450upx;" >
					<view v-for="(item,index) in ques2Files">
						<view style="float: left; padding-top: 10upx;  margin-right: 20upx;font-size: 26upx;color: #0000FF;text-decoration:underline;" @click="downFile(item)">简答题{{index+1}}.{{item.split('.').pop().toLowerCase()}}</view>
					</view>
					<view style="height: 20upx;"></view>
				</view>
			</view>
		</view>
		<!-- 建议分数 -->
		<view class="wc jianyi" v-if="neirong.task10||neirong.task8">
			<span class="bt">分数：</span>
			<input class="dafen" type="text" v-model="score3" placeholder="输入分数"/>
		</view>
		<view style="display: block !important;" v-if="neirong.task10||neirong.task8">
			<button class="mini-btn" type="warn" size="mini" @click="fillScore3(90)" style="margin-left: 20upx;" >优秀</button>
			<button class="mini-btn" type="warn" size="mini" @click="fillScore3(80)" style="margin-left: 20upx;" >良好</button>
			<button class="mini-btn" type="warn" size="mini" @click="fillScore3(70)" style="margin-left: 20upx;" >中等</button>
			<button class="mini-btn" type="warn" size="mini" @click="fillScore3(60)" style="margin-left: 20upx;" >及格</button>
			<button class="mini-btn" type="warn" size="mini" @click="fillScore3(50)" style="margin-left: 20upx;" >不及格</button>
		</view>
		<!-- 横线 -->
		<hengxian v-if="neirong.task10"></hengxian>
		
		<!-- 保存 -->
		<view class="uni-padding-wrap uni-common-mt baocun">
			<button class="mini-btn" type="warn" size="mini" @click="tiao()" style="margin-right: 20upx;">提交</button>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				baseUrl:'',
				ques1Content:'',
				ques2Content:'',
				reportContent:'',
				activiFiles:[],
				ques1Files:[],
				ques2Files:[],
				reportFiles:[],
				ls:[],
				neirong:[],
				id:[],
				ids:[],
				scores:[],//建议分数
				score1:'',
				score2:'',
				score3:'',
			    contentOther:'',
			}
		},
		onLoad(option) {
			console.log(option);
			this.baseUrl = 'http://'+uni.getStorageSync("baseUrl");
			this.id = option.id
			this.ids = option.rwid
			this.shuxin()
			this.getAdviseScore();
		},
		onReady() {
		},
		onShow() {
		},
		created() {
			
		},
		methods:{
			fillScore1(score){
				this.score1 = score;
			},
			fillScore2(score){
				this.score2 = score;
			},
			fillScore3(score){
				this.score3 = score;
			},
			//文件下载
			downFile(url){
				url = this.baseUrl + '/file/' + url;
				plus.runtime.openURL(url, function(res) {
				                        // console.log(res);  
				                    });
			},
			//获取建议分数
			getAdviseScore(){
				let that = this;
				
      that.pyReq(that.$http.getScoreByTea, {
          stuId: that.id,
          taskedId: that.ids,
      }, function (res) {
        that.score1 = res.result.score1;
        that.score2 = res.result.score2;
        that.score3 = res.result.score3;
        if(that.score1 == -1){
          that.pyReq(that.$http.getAdviseScore, {}, function (res) {
            that.score1 = res.result.score1;
            that.score2 = res.result.score2;
            that.score3 = res.result.score3;
          });
        }
      });
			},
			shuxin(){
				let that = this
				let params = {
				  "stuId":that.id,
				  "taskedId":that.ids,
				}
				that.pyReq(that.$http.getStuTaskedDetailByTea,params,function(res){
						that.neirong = res.result
						if(that.neirong.task5.content){
							that.ques1Content = that.neirong.task5.content
						}
						if(that.neirong.task6.content){
							that.ques2Content = that.neirong.task6.content
						}
						if(that.neirong.task7.content){
							that.contentOther = that.neirong.task7.content
						}
						if(that.neirong.task10.content){
							that.reportContent = that.neirong.task10.content
						}
						if(that.neirong.task5.fileUrl){
							that.ques1Files = that.neirong.task5.fileUrl
						}
						if(that.neirong.task6.fileUrl){
							that.ques2Files = that.neirong.task6.fileUrl
						}
						if(that.neirong.task7.fileUrl){
							that.ques2Files = that.neirong.task7.fileUrl
						}
						if(that.neirong.task10.fileUrl){
							that.reportFiles = that.neirong.task10.fileUrl
						}
						// that.wb = res.result.task5.content
						// that.ls = res.result.task6.content
				});
			},
			//跳转到批阅
			toNext(){
				let that = this;
				uni.navigateTo({
					url:"./renwupiyue?id="+that.id+'&ids='+that.ids
				})
			},
			tiao(){
				let that = this
				let params = {
				  "stuId":that.id,
				  "taskedId":that.ids,
				}
				if(that.neirong.task1||that.neirong.task9||that.neirong.task3||that.neirong.task4){
					params.score1 = that.score1
				}
				if(that.neirong.task5||that.neirong.task6||that.neirong.task7){
					params.score2 = that.score2
				}
				if(that.neirong.task10){
					params.score3 = that.score3
				}
				// this.baseUrl = 'http://'+uni.getStorageSync("baseUrl");
				// this.id = option.id
				// this.ids = option.rwid
				// this.shuxin()
				// this.getAdviseScore();
				
				that.pyReq(that.$http.correctTasked,params,function(res){
					that.pyReq(that.$http.getStuIdByTaskedId,{stuId:that.id ,taskedId:that.ids},function(res){
						if(res.msg=='已全部批阅'){
							uni.navigateBack({
								
							})
						}else{
							uni.redirectTo({
								url:'./wancheng?id='+res.result+'&rwid='+that.ids,
							})
						}						
					})
				});
			}
		}
	}
</script>

<style>
	.downLoadBtn{
		width: 200upx;
		height: 50upx;
		margin: 10upx 0 0upx 0upx;
		font-size: 24upx;
		line-height: 50upx;
		color: #BA2B26;
	}
	.style1{
		font-size: 26upx;
		color: #333;
	}
	.baocun{
		float: right;
		clear: both;
		padding-top: 50upx;
		padding-bottom: 100upx;
	}
	.baocun button{
		width: 190upx;
		height: 50upx;
		font-size: 26upx;
		line-height: 50upx;
	}
	.piyue{
		background-color: #666666;
	}
	.bao{
		margin-right: 20upx;
	}
	.wanch{
		border-bottom: 1px solid #666666;
	}
	.wc{
		margin: 30upx;
	}
	.jianyi{
		display: flex;
	}
	.dafen{
		width: 190upx;
		height: 40upx;
		border: 1px solid #666666;
		font-size: 28upx;
		padding-left: 15upx;
		border-radius: 10upx;
	}
	.wc text{
		display: block;
		font-size: 27upx;
		color: #333333;
		line-height: 50upx;
	}
	.wc>.zbt{
		font-weight: 700;
	}
	.wc .xiazai{
		color: #002694;
	}
	.wc .iconfont{
		font-size: 20upx;
		margin-left: 30upx;
		color: #333333;
	}
	.jianda{
		width: 642upx;
		height: 148upx;
		border: 1px solid #666666;
		margin-top: 20upx;
		font-size: 28upx;
		padding: 20upx;
		border-radius: 10upx;
	}
</style>
